{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
  <div class="medium-9 columns">
    <div class="section" style="padding-top: 1rem;">
    {% include "partials/discussion_list.html" %}
    </div>
  </div>
  <div class="medium-3 columns">
  {% if vnode.type == model.document.TYPE_PROBLEM %}
    {% set pdoc = vnode %}
    {% set owner_udoc = udict[vnode.owner] %}
    {% include "partials/problem_sidebar.html" %}
  {% elif vnode.type == model.document.TYPE_CONTEST %}
    {% set tdoc = vnode %}
    {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%}
    {% set tsdoc = { attend: tdoc.attend } %}
    {%- endif -%}
    {% set owner_udoc = udict[vnode.owner] %}
    {% include "partials/contest_sidebar.html" %}
  {% else %}
    <div class="section side">
      {% if vnode.pic %}<div class="discussion-node__bg {{ vnode.pic }}"></div>{% endif %}
      <div class="section__header">
        <h1 class="section__title">{{ vnode['title'] or _('Create Discussion') }}</h1>
      </div>
      <div class="section__body">
      {% if vnode._id %}
        {% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
          <p><a href="{{ url('discussion_create', type=model.discussion.typeDisplay[vnode.type], name=vnode.id) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
        {% else %}
          {% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
            <p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
          {% else %}
            <p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
          {% endif %}
        {% endif %}
      {% else %}
        <p>{{ _('Select a node to create discussion.') }}</p>
      {% endif %}
      </div>
    </div>
  {% endif %}
  {% include 'partials/discussion_nodes_widget.html' %}
  </div>
</div>
{% endblock %}
